{% extends "layouts/application.html" %}
{% block content %}

<div align="center">
  <DIV class=boxright>
    <DIV class=bltop2>
      <div align="left">&nbsp;&nbsp;&nbsp;
        <strong>
          &nbsp;&nbsp;&nbsp;当前位置：用户个人信息管理
        </strong>
      </div>
    </DIV>
    {% if obj %}
    <DIV class=c_box>
      <DIV class="rep_left">
		<form name="reinfo" action="" method="post">
          <TABLE id=tblSearch  cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdp height=22 ALIGN="left"><STRONG>个人信息修改</STRONG></TD>
                <TD class=rtdp align="right" COLSPAN="3">&nbsp;</TD>
              </TR>
              <TR>
                <TD COLSPAN="4" class=rep_li_c2 width="20%" ALIGN="left">
                  <span id="ulogin_name"></span>
                &nbsp;</TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 width="20%" ALIGN="left">登录名</TD>
                <TD class=rep_li_c2 width="30%" ALIGN="left">
                 	{{obj.username}}
                </TD>
                <TD class=rep_li_c2 width="20%" ALIGN="left">真实姓名</TD>
                <TD class=rep_li_c2 width="30%" ALIGN="left">
                  {{form_profile.real_name}}{{form_profile.real_name.errors}}
                </TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 ALIGN="left">单位</TD>
                <TD class=rep_li_c2 ALIGN="left">
                {{form_profile.department}}{{form_profile.department.errors}}
                </TD>
                <TD class=rep_li_c2 ALIGN="left">电话</TD>
                <TD class=rep_li_c2 ALIGN="left">
                {{form_profile.phone}}{{form_profile.phone.errors}}
                </TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 colSpan=4>
                  <INPUT ONCLICK="return onadd();" onMouseOver="this.className='submit2'" onMouseOut="this.className='submit'" class=submit id="modify" type=submit value="修改" name="">
                  <INPUT onMouseOver="this.className='reset2'" onMouseOut="this.className='reset'" id="btn8" class="reset"  type="reset" value=取消>
                </TD>
              </TR>
            </TBODY>
          </TABLE>
		</form>

        <form name="repass" action="" method="post">
          <TABLE id=tblSearch  cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdp height=22 ALIGN="left"><STRONG>修改密码</STRONG></TD>
                <TD class=rtdp align="right" COLSPAN="3">&nbsp;</TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 width="10%" ALIGN="left">旧密码</TD>
                <TD class=rep_li_c2 width="30%" ALIGN="left">
                  <input id="old_pass" type="password" name="old_pass" class="text" style="WIDTH: 230px">
                </TD>
                <TD class=rep_li_c2 width="20%" ALIGN="left">
                  <span id="sp_oldpwd"></span>
                &nbsp;</TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 ALIGN="left">新密码</TD>
                <TD class=rep_li_c2 ALIGN="left"><input id="new_pass" type="password" name="new_pass" class="text" style="WIDTH: 230px"></TD>
                <TD class=rep_li_c2 ALIGN="left">&nbsp;</TD>
              </TR>
              <TR>
                <TD class=rep_li_c2 ALIGN="left">确认新密码</TD>
                <TD class=rep_li_c2 ALIGN="left"><input id="con_pass" type="password" name="conf_pass" class="text" style="WIDTH: 230px"></TD>
                <TD class=rep_li_c2 ALIGN="left">&nbsp;</TD>
              </TR>
              <tr>
              <td colspan="3"><span style="color:red;">{{message}}</span></td>
              </tr>
              <TR>
                <TD class=rep_li_c2 colSpan=4>
                  <INPUT onclick="return pass_change();" onMouseOver="this.className='submit2'" onMouseOut="this.className='submit'" class=submit id="btn_save" type=submit value="修改">
                  <INPUT onMouseOver="this.className='reset2'" onMouseOut="this.className='reset'" id="btn8" class="reset"  type="reset" value=取消>
                </TD>
              </TR>
            </TBODY>
          </TABLE>
          </form>
      </DIV>
    </DIV>
   {% else %}
   对不起！你没有权限编辑此用户！
   {% endif %}

    <SCRIPT type="text/javascript">
        function pass_change()
        {
            if($("#old_pass").val()=="")
            {
                alert("请输入旧密码！");
                return false;
            }
            if($("#new_pass").val()=="")
            {
                alert("请输入新密码！");
                return false;
            }
            if($("#con_pass").val()=="")
            {
                alert("请输入确认新密码！");
                return false;
            }

            if($("#new_pass").val()!= $("#con_pass").val())
            {
                alert("两次输入的密码不同，请重新输入");
                $("#new_pass").value="";
                $("#con_pass").value="";
                $("#new_pass").focus();
                return false;
            }
            return true;
        }
    </SCRIPT>
  </DIV>
</div>
{% endblock %}
